1. Field of the Invention
Embodiments of the invention relate to the field of operating systems, and more specifically, to threads.
2. Background
Programming languages that have built-in thread features, such as Java or C#, normally provide associated synchronization mechanisms for coordinating among multiple threads. This necessitates the corresponding Virtual Machine to provide instructions to support the thread synchronization or locking semantics. These thread synchronization and locking semantics are enforced by the run-time system.
For example, in the Java Virtual Machine (JVM) language, the monitorenter/monitorexit instruction is used to implement a synchronized statement in the Java programming language. Each object has an associated monitor. Ownership of a monitor is implemented by a locking mechanism.
Currently, traditional techniques implement locks in a thread-safe manner. In other words, they assume the application has more than one thread. In the lock or monitor implementation, atomic operations are time-consuming operations in the execution path. This is because these operations have little concurrency or parallelism to be exploited. In addition, they need the support and involvement of the processor architecture and the operating system. In a multi-thread environment, a single thread suffers a high overhead in lock and unlock operations.